package co.fitstart.entity.user.basic;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.course.round.CourseRound;
import co.fitstart.entity.user.basic.enums.BodyDataType;

/**
 * 身体数据目标
 * @author haiyan_xiao
 *
 */
@Entity
@Table(name = "bady_data_target")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class BodyDataTarget {
    @Id
    @GeneratedValue
    private Long id;
    
    /** 所属课次 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private CourseRound courseRound;
    
    /** 身体数据类型 */
    @Enumerated(EnumType.ORDINAL)
    private BodyDataType bodyDataType;
    
    /** 当前数据 */
    private BigDecimal currentValue;
    
    /** 理想远期目标数据 */
    private BigDecimal idealValue;
    
    /** 教练设定目标数据 */
    private BigDecimal coachIdealValue;
    
    private Date createTime;
    
    @Column(name = "is_disabled")
    private boolean disabled;
    
    public BodyDataTarget() {
        
    }
    
    public BodyDataTarget(CourseRound courseRound, BodyDataType bodyDataType) {
        this.courseRound = courseRound;
        this.bodyDataType = bodyDataType;
        this.createTime = new Date();
    }
    
    /**
     * edit
     * @param currentValue
     * @param idealValue
     * @param reachWeeks
     * @param coachIdealValue
     * @return
     */
    public BodyDataTarget edit(BigDecimal currentValue, BigDecimal idealValue, BigDecimal coachIdealValue) {
        this.currentValue = currentValue;
        this.idealValue = idealValue;
        this.coachIdealValue = coachIdealValue;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the courseRound
     */
    public CourseRound getCourseRound() {
        return courseRound;
    }

    /**
     * @return the bodyDataType
     */
    public BodyDataType getBodyDataType() {
        return bodyDataType;
    }

    /**
     * @return the currentValue
     */
    public BigDecimal getCurrentValue() {
        return currentValue;
    }

    /**
     * @return the idealValue
     */
    public BigDecimal getIdealValue() {
        return idealValue;
    }

    /**
     * @return the coachIdealValue
     */
    public BigDecimal getCoachIdealValue() {
        return coachIdealValue;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param courseRound the courseRound to set
     */
    public void setCourseRound(CourseRound courseRound) {
        this.courseRound = courseRound;
    }

    /**
     * @param bodyDataType the bodyDataType to set
     */
    public void setBodyDataType(BodyDataType bodyDataType) {
        this.bodyDataType = bodyDataType;
    }

    /**
     * @param currentValue the currentValue to set
     */
    public void setCurrentValue(BigDecimal currentValue) {
        this.currentValue = currentValue;
    }

    /**
     * @param idealValue the idealValue to set
     */
    public void setIdealValue(BigDecimal idealValue) {
        this.idealValue = idealValue;
    }

    /**
     * @param coachIdealValue the coachIdealValue to set
     */
    public void setCoachIdealValue(BigDecimal coachIdealValue) {
        this.coachIdealValue = coachIdealValue;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }
}
